﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using ComponentFactory.Krypton.Toolkit;
namespace TinyERP.Framework.Controls
{
    public class KButton : KryptonButton, ILocalizable
    {
        public const int DEFAULT_BUTTON_WIDTH = 99;
        public const int DEFAULT_BUTTON_HEIGHT = 25;
        public string ResourceModuleKey { get; set; }
        public string ResourceKey { get; set; }
        public void UpdateLanguage()
        {
            if (!string.IsNullOrEmpty(this.ResourceModuleKey))
            {
                this.Text = ModuleResourceManager.GetInstance().GetStringFromModuleResourceKey(ResourceModuleKey);
            }
            else
            {
                this.Text = AppResourceManager.GetInstance().GetString(ResourceKey);
            }
        }
        public KButton()
            : base()
        {
            this.ButtonStyle = ButtonStyle.Standalone;
            this.Values.Text = "";
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.AutoSize = false;
            this.Width = DEFAULT_BUTTON_WIDTH;
            this.Height = DEFAULT_BUTTON_HEIGHT;
        }
        public override string Text
        {
            get { return this.Values.ExtraText; }
            set { this.Values.ExtraText = value; }
        }
        public Image Image
        {
            get { return this.Values.Image; }
            set 
            { 
                this.Values.Image = value;
            }

        }
    }
    public class SaveButton : KButton

    {
        public SaveButton()
            : base()
        {
            
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.save.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Save");
            this.ResourceKey = "Save";
            
        }
    }

    public class NewButton : KButton
    {
        public NewButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.new.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("New");
            this.ResourceKey = "New";
            this.AutoSize = true;
        }
    }
    public class EditButton : KButton
    {
        public EditButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.edit.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Edit");
            this.ResourceKey = "Edit";
            this.AutoSize = true;
        }
    }
    public class FindButton : KButton
    {
        public FindButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.find.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Find");
            this.ResourceKey = "Find";
        }
    }
    public class DeleteButton : KButton
    {
        public DeleteButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.delete.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Delete");
            this.ResourceKey = "Delete";
            this.AutoSize = true;
        }
    }
    public class HomeButton : KButton
    {
        public HomeButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-home.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("GoHome");
            this.ResourceKey = "GoHome";
            this.AutoSize = true;
        }
    }

    public class CloseButton : KButton
    {
        public CloseButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.close.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Close");
            this.ResourceKey = "Close";
            this.AutoSize = true;
        }
    }

    public class FirstButton : KButton
    {
        public FirstButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-first.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("First");
            this.ResourceKey = "First";
            this.AutoSize = true;
        }
    }

    public class LastButton : KButton
    {
        public LastButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-last.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Last");
            this.ResourceKey = "Last";
            this.AutoSize = true;
        }
    }

    public class NextButton : KButton
    {
        public NextButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-next.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Next");
            this.ResourceKey = "Next";
            this.AutoSize = true;
        }
    }

    public class PreviousButton : KButton
    {
        public PreviousButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-previous.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Previous");
            this.ResourceKey = "Previous";
            this.AutoSize = true;
        }
    }

    public class UpButton : KButton
    {
        public UpButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-up.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Up");
            this.ResourceKey = "Up";
            
        }
    }
    public class DownButton : KButton
    {
        public DownButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.go-down.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = AppResourceManager.GetInstance().GetString("Down");
            this.ResourceKey = "Down";
            
        }
    }

    public class AddIconButton : KButton
    {
        public AddIconButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.new.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = "";
            this.AutoSize = true;
        }
    }

    public class RemoveIconButton : KButton
    {
        public RemoveIconButton()
            : base()
        {
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream("TinyERP.Framework.Resources.button.delete.png");
            this.Image = Image.FromStream(imageStream);
            this.Text = "";
            this.AutoSize = true;
        }
    }
}
